import {connect} from 'react-redux';
import * as Action from '../../../store/action/actionTask'

function AddTask(props){
    const {task,handleChange,handleAddTask} = props
    return (
        <div>
            <input type='text'  value={task} onChange={handleChange}/>
            <button onClick={handleAddTask}>add task</button>
        </div>
    )
  }

  const mapState  = state =>({
    task:state.task.task
  })
  const mapDispatch  = dispatch=>({
    handleChange:(e)=>dispatch(Action.syncAction(e.target.value)),
    handleAddTask:()=>dispatch(Action.addAction())
  })

  export default connect(mapState,mapDispatch)(AddTask)